<?php

namespace app\api\controller\v1;

use think\Controller;
use think\Request;
use think\Db;
// use app\api\controller\v1\ali_Video;


class Fans extends Controller
{
	public function index()
	{
		echo "fans";
	}

	public function show_user_petinfo(){
		$result = Db::query("select *from ym_pet");
        // $pagesize = 3;
        // $user_id,$pageno
        // $startno = $pageno * $pagesize;
        // $result = Db::query("select a.pet_id,a.pet_name,a.pet_gender,a.pet_brith,a.pet_kind,a.pet_status,a.pet_icon,b.fans_count,c.pet_hungry_level from ym_pet as a join user_info as b on a.user_id = b.user_id join ym_pet_hungry as c on a.pet_id = c.pet_id where a.user_id = '$user_id' and a.permisstion_to_access = 1 ORDER BY a.pet_id desc limit {$startno},{$pagesize}");
        // var_dump($result);
        return json($result);
    }

    public function get_ads_img(){
        $result = Db::query("select ads_img_url from ym_ads_img");
        $length = count($result);
        $img = [];
        for ($i=0; $i < $length; $i++) { 
            $img[] = $result[$i]['ads_img_url'];
        }

        return $result;
    }
}